__wxCodeSpace__.batchAddCompiledTemplate(function (G, R, D, Q, gdc, X, Y, Z) {
  return {
    "pages/run/run": (() => {
      var P = "pages/run/run";
      var H = {};
      var I = {};
      H[""] = I[""] = (R, C, D, U) => {
        var L = R.c;
        var M = R.m;
        var O = R.r;
        var A = {};
        var K = U === true;
        return {
          C: (C, T, E, B) => {
            var a = D.runningState == 0 ? 1 : 0;
            B(a, (C, T, E) => {
              if (a === 1) {
                E(
                  "view",
                  {},
                  (N, C) => {
                    if (C) L(N, "start-timer-view");
                  },
                  (C, T, E) => {
                    E(
                      "text",
                      {},
                      (N, C) => {
                        if (C || K || U.animation_countdown)
                          O(N, "animation", D.animation_countdown);
                      },
                      (C, T) => {
                        C || K || U.countdwnSecond
                          ? T(Y(D.countdwnSecond))
                          : T();
                      }
                    );
                  }
                );
              } else {
                E(
                  "view",
                  {},
                  (N, C) => {
                    if (C)
                      R.y(N, "position: fixed;  width: 100%; height: 100%;");
                  },
                  (C, T, E, B) => {
                    E(
                      "view",
                      {},
                      (N, C) => {
                        if (C) L(N, "content");
                        if (C || K || !!U.mapViewHeight || undefined)
                          R.y(N, "height: " + Y(D.mapViewHeight) + ";");
                      },
                      (C, T, E) => {
                        E(
                          "view",
                          {},
                          (N, C) => {
                            if (C) L(N, "map-wrap");
                          },
                          (C, T, E) => {
                            E(
                              "map",
                              {},
                              (N, C) => {
                                if (C) R.i(N, "map");
                                if (C || K || U.isSatelliteStyle)
                                  O(N, "enable-satellite", D.isSatelliteStyle);
                                if (C || K || U.longitude)
                                  O(N, "longitude", D.longitude);
                                if (C) O(N, "show-location", "false");
                                if (C || K || U.latitude)
                                  O(N, "latitude", D.latitude);
                                if (C) O(N, "scale", "16");
                                if (C || K || U.markers)
                                  O(N, "markers", D.markers);
                                if (C || K || U.polyline)
                                  O(N, "polyline", D.polyline);
                              },
                              (C) => {}
                            );
                          }
                        );
                      }
                    );
                    var b = D.runningState == 1 || D.runningState == 2 ? 1 : 0;
                    B(b, (C, T, E) => {
                      if (b === 1) {
                        E(
                          "view",
                          {},
                          (N, C) => {
                            if (C) L(N, "view-run-speed");
                          },
                          (C, T, E) => {
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-run-speed-item");
                              },
                              (C, T, E) => {
                                E(
                                  "image",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      O(N, "src", "../../images/distance.png");
                                    if (C) O(N, "mode", "aspectFit");
                                  },
                                  (C) => {}
                                );
                                E(
                                  "text",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      R.y(
                                        N,
                                        "font-size: 45rpx; font-weight: bold;"
                                      );
                                  },
                                  (C, T) => {
                                    C || K || U.runDistance
                                      ? T(Y(D.runDistance))
                                      : T();
                                  }
                                );
                                E(
                                  "text",
                                  {},
                                  (N, C) => {},
                                  (C, T) => {
                                    C ? T("公里") : T();
                                  }
                                );
                              }
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-run-speed-item");
                              },
                              (C, T, E) => {
                                E(
                                  "image",
                                  {},
                                  (N, C) => {
                                    if (C) O(N, "src", "../../images/time.png");
                                    if (C) O(N, "mode", "aspectFit");
                                  },
                                  (C) => {}
                                );
                                E(
                                  "text",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      R.y(
                                        N,
                                        "font-size: 45rpx; font-weight: bold;"
                                      );
                                  },
                                  (C, T) => {
                                    C || K || U.runTime ? T(Y(D.runTime)) : T();
                                  }
                                );
                                E(
                                  "text",
                                  {},
                                  (N, C) => {},
                                  (C, T) => {
                                    C ? T("用时") : T();
                                  }
                                );
                              }
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-run-speed-item");
                              },
                              (C, T, E) => {
                                E(
                                  "image",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      O(N, "src", "../../images/speed.png");
                                    if (C) O(N, "mode", "aspectFit");
                                  },
                                  (C) => {}
                                );
                                E(
                                  "text",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      R.y(
                                        N,
                                        "font-size: 45rpx; font-weight: bold;"
                                      );
                                  },
                                  (C, T) => {
                                    C || K || U.runSpeed
                                      ? T(Y(D.runSpeed))
                                      : T();
                                  }
                                );
                                E(
                                  "text",
                                  {},
                                  (N, C) => {},
                                  (C, T) => {
                                    C ? T("实时配速") : T();
                                  }
                                );
                              }
                            );
                          }
                        );
                      }
                    });
                    var c = D.runningState == 1 || D.runningState == 2 ? 1 : 0;
                    B(c, (C, T, E) => {
                      if (c === 1) {
                        E(
                          "view",
                          {},
                          (N, C) => {
                            if (C) L(N, "view-run-control");
                          },
                          (C, T, E, B) => {
                            var d =
                              D.runningState == 1
                                ? 1
                                : D.runningState == 2
                                ? 2
                                : 0;
                            B(d, (C, T, E) => {
                              if (d === 1) {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) R.r(N, "bindtap", "pauseRun");
                                    if (C) L(N, "view-pause");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "image",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          O(N, "src", "../../images/pause.png");
                                        if (C) O(N, "mode", "aspectFit");
                                      },
                                      (C) => {}
                                    );
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {},
                                      (C, T) => {
                                        C ? T("暂停") : T();
                                      }
                                    );
                                  }
                                );
                              } else if (d === 2) {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "view-select-stop");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) R.r(N, "bindtap", "stopRun");
                                        if (C) L(N, "view-stop");
                                        if (C || K || U.animation_stop)
                                          O(N, "animation", D.animation_stop);
                                      },
                                      (C, T, E) => {
                                        E(
                                          "image",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              O(
                                                N,
                                                "src",
                                                "../../images/stop.png"
                                              );
                                            if (C) O(N, "mode", "aspectFit");
                                          },
                                          (C) => {}
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {},
                                          (C, T) => {
                                            C ? T("结束") : T();
                                          }
                                        );
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) R.r(N, "bindtap", "startRun");
                                        if (C) L(N, "view-continue");
                                        if (C || K || U.animation_continue)
                                          O(
                                            N,
                                            "animation",
                                            D.animation_continue
                                          );
                                      },
                                      (C, T, E) => {
                                        E(
                                          "image",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              O(
                                                N,
                                                "src",
                                                "../../images/start-run.png"
                                              );
                                            if (C) O(N, "mode", "aspectFit");
                                          },
                                          (C) => {}
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {},
                                          (C, T) => {
                                            C ? T("继续") : T();
                                          }
                                        );
                                      }
                                    );
                                  }
                                );
                              }
                            });
                          }
                        );
                      }
                    });
                    var d = D.runningState != 3 ? 1 : 0;
                    B(d, (C, T, E) => {
                      if (d === 1) {
                        E(
                          "view",
                          {},
                          (N, C) => {
                            if (C) L(N, "view-map-btn");
                          },
                          (C, T, E) => {
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-mapStyle");
                                if (C) R.r(N, "bindtap", "onChangeMapStyle");
                              },
                              (C, T, E) => {
                                E(
                                  "image",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      O(N, "src", "../../images/style.png");
                                  },
                                  (C) => {}
                                );
                              }
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-mapShare");
                              },
                              (C, T, E) => {
                                E(
                                  "button",
                                  {},
                                  (N, C) => {
                                    if (C) O(N, "open-type", "share");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "image",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          O(N, "src", "../../images/share.png");
                                      },
                                      (C) => {}
                                    );
                                  }
                                );
                              }
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-feedback");
                              },
                              (C, T, E) => {
                                E(
                                  "image",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      O(N, "src", "../../images/feedback.png");
                                  },
                                  (C) => {}
                                );
                                E(
                                  "button",
                                  {},
                                  (N, C) => {
                                    if (C) O(N, "open-type", "contact");
                                    if (C) R.y(N, "width: 100%;");
                                    if (C) L(N, "view-contact-btn");
                                  },
                                  (C) => {}
                                );
                              }
                            );
                          }
                        );
                      }
                    });
                    var e = D.runningState == 3 ? 1 : 0;
                    B(e, (C, T, E) => {
                      if (e === 1) {
                        E(
                          "scroll-view",
                          {},
                          (N, C) => {
                            if (C) L(N, "scroll-view-container");
                            if (C || K || undefined) O(N, "scroll-y", true);
                          },
                          (C, T, E, B) => {
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "scroll-view-container-header-top");
                              },
                              (C) => {}
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-run-result");
                              },
                              (C, T, E) => {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "result-user-info");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "image",
                                      {},
                                      (N, C) => {
                                        if (C) R.i(N, "user-info-icon");
                                        if (
                                          C ||
                                          K ||
                                          !!(
                                            Z(U.avator, "length") || U.avator
                                          ) ||
                                          undefined
                                        )
                                          O(
                                            N,
                                            "src",
                                            X(D.avator).length
                                              ? D.avator
                                              : "../../images/avator.png"
                                          );
                                        if (C) O(N, "mode", "aspectFit");
                                      },
                                      (C) => {}
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "user-info-text");
                                      },
                                      (C, T, E) => {
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "padding-bottom: 10rpx;font-size:  35rpx; color: #fff; font-weight: bold;"
                                              );
                                          },
                                          (C, T) => {
                                            C ||
                                            K ||
                                            !!(
                                              Z(U.nickname, "length") ||
                                              U.nickname
                                            ) ||
                                            undefined
                                              ? T(
                                                  Y(
                                                    X(D.nickname).length
                                                      ? D.nickname
                                                      : "跑友"
                                                  )
                                                )
                                              : T();
                                          }
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "color: rgb(122, 118, 118);"
                                              );
                                          },
                                          (C, T) => {
                                            C || K || U.runStartTimeStr
                                              ? T(Y(D.runStartTimeStr))
                                              : T();
                                          }
                                        );
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "user-info-setting");
                                        if (C)
                                          R.r(N, "bindtap", "onSettingUseInfo");
                                      },
                                      (C, T, E) => {
                                        E(
                                          "image",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              O(
                                                N,
                                                "src",
                                                "../../images/setting.png"
                                              );
                                          },
                                          (C) => {}
                                        );
                                      }
                                    );
                                  }
                                );
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "result-run-distance");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          R.y(
                                            N,
                                            "font-size: 100rpx; font-weight: bold; color: #fff;"
                                          );
                                      },
                                      (C, T) => {
                                        C || K || U.runDistance
                                          ? T(Y(D.runDistance))
                                          : T();
                                      }
                                    );
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          R.y(
                                            N,
                                            "font-size: 40rpx;  margin-left:15rpx;color: rgb(105, 100, 100); font-weight: bold;"
                                          );
                                      },
                                      (C, T) => {
                                        C ? T("公里") : T();
                                      }
                                    );
                                  }
                                );
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "result-run-speed-bar");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "speed-bar-left");
                                      },
                                      (C) => {}
                                    );
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          R.y(
                                            N,
                                            "font-size:30rpx;color: rgb(250,100,0); padding: 5rpx;"
                                          );
                                      },
                                      (C, T) => {
                                        C ? T("慢") : T();
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "speed-bar-middle");
                                      },
                                      (C) => {}
                                    );
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          R.y(
                                            N,
                                            "font-size:30rpx;color: rgb(100,250,0); padding: 5rpx;"
                                          );
                                      },
                                      (C, T) => {
                                        C ? T("快") : T();
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "speed-bar-right");
                                      },
                                      (C) => {}
                                    );
                                  }
                                );
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "result-run-detail-info");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {},
                                      (C, T, E) => {
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "font-size: 50rpx;font-weight: bold;"
                                              );
                                          },
                                          (C, T) => {
                                            C || K || U.avgSpeed
                                              ? T(Y(D.avgSpeed))
                                              : T();
                                          }
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "font-size: 30rpx;margin-top: 20rpx;"
                                              );
                                          },
                                          (C, T) => {
                                            C ? T("平均配速") : T();
                                          }
                                        );
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {},
                                      (C, T, E) => {
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "font-size: 50rpx;font-weight: bold;"
                                              );
                                          },
                                          (C, T) => {
                                            C || K || U.runTime
                                              ? T(Y(D.runTime))
                                              : T();
                                          }
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "font-size: 30rpx;margin-top: 20rpx;"
                                              );
                                          },
                                          (C, T) => {
                                            C ? T("用时") : T();
                                          }
                                        );
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {},
                                      (C, T, E) => {
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "font-size: 50rpx;font-weight: bold;"
                                              );
                                          },
                                          (C, T) => {
                                            C || K || U.runColarie
                                              ? T(Y(D.runColarie))
                                              : T();
                                          }
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "font-size: 30rpx;margin-top: 20rpx;"
                                              );
                                          },
                                          (C, T) => {
                                            C ? T("消耗大卡") : T();
                                          }
                                        );
                                      }
                                    );
                                  }
                                );
                              }
                            );
                            var f = X(D.speedDetailArr).length > 1 ? 1 : 0;
                            B(f, (C, T, E) => {
                              if (f === 1) {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "view-run-detail-speed");
                                  },
                                  (C, T, E, B, F) => {
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          R.y(
                                            N,
                                            "display:flex;justify-content: center; width:150rpx;font-size: 35rpx; margin-top: 20rpx; color: rgb(145,145,145);"
                                          );
                                      },
                                      (C, T, E) => {
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {},
                                          (C, T) => {
                                            C ? T("配速") : T();
                                          }
                                        );
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "detail-speed-header");
                                      },
                                      (C, T, E) => {
                                        E(
                                          "view",
                                          {},
                                          (N, C) => {},
                                          (C, T, E) => {
                                            E(
                                              "text",
                                              {},
                                              (N, C) => {
                                                if (C)
                                                  R.y(
                                                    N,
                                                    "font-size: 50rpx;font-weight: bold;"
                                                  );
                                              },
                                              (C, T) => {
                                                C || K || U.minSpeed
                                                  ? T(Y(D.minSpeed))
                                                  : T();
                                              }
                                            );
                                            E(
                                              "view",
                                              {},
                                              (N, C) => {
                                                if (C)
                                                  R.y(
                                                    N,
                                                    "display: flex; flex-direction: row;align-items: center;justify-content: center;"
                                                  );
                                              },
                                              (C, T, E) => {
                                                E(
                                                  "view",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(
                                                        N,
                                                        "width: 10rpx;height: 10rpx;border-radius: 2rpx; background-color: #f00;"
                                                      );
                                                  },
                                                  (C) => {}
                                                );
                                                E(
                                                  "text",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(
                                                        N,
                                                        "font-size: 30rpx;margin-left:10rpx;"
                                                      );
                                                  },
                                                  (C, T) => {
                                                    C ? T("最慢") : T();
                                                  }
                                                );
                                              }
                                            );
                                          }
                                        );
                                        E(
                                          "view",
                                          {},
                                          (N, C) => {},
                                          (C, T, E) => {
                                            E(
                                              "text",
                                              {},
                                              (N, C) => {
                                                if (C)
                                                  R.y(
                                                    N,
                                                    "font-size: 50rpx;font-weight: bold;"
                                                  );
                                              },
                                              (C, T) => {
                                                C || K || U.avgSpeed
                                                  ? T(Y(D.avgSpeed))
                                                  : T();
                                              }
                                            );
                                            E(
                                              "text",
                                              {},
                                              (N, C) => {
                                                if (C)
                                                  R.y(N, "font-size: 30rpx;");
                                              },
                                              (C, T) => {
                                                C ? T("平均") : T();
                                              }
                                            );
                                          }
                                        );
                                        E(
                                          "view",
                                          {},
                                          (N, C) => {},
                                          (C, T, E) => {
                                            E(
                                              "text",
                                              {},
                                              (N, C) => {
                                                if (C)
                                                  R.y(
                                                    N,
                                                    "font-size: 50rpx;font-weight: bold;"
                                                  );
                                              },
                                              (C, T) => {
                                                C || K || U.maxSpeed
                                                  ? T(Y(D.maxSpeed))
                                                  : T();
                                              }
                                            );
                                            E(
                                              "view",
                                              {},
                                              (N, C) => {
                                                if (C)
                                                  R.y(
                                                    N,
                                                    "display: flex; flex-direction: row;align-items: center;justify-content: center;"
                                                  );
                                              },
                                              (C, T, E) => {
                                                E(
                                                  "view",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(
                                                        N,
                                                        "width: 10rpx;height: 10rpx;border-radius: 2rpx; background-color: #0f0;"
                                                      );
                                                  },
                                                  (C) => {}
                                                );
                                                E(
                                                  "text",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(
                                                        N,
                                                        "font-size: 30rpx;margin-left:10rpx;"
                                                      );
                                                  },
                                                  (C, T) => {
                                                    C ? T("最快") : T();
                                                  }
                                                );
                                              }
                                            );
                                          }
                                        );
                                      }
                                    );
                                    E(
                                      "view",
                                      {},
                                      (N, C) => {
                                        if (C) L(N, "detail-speed-main-title");
                                      },
                                      (C, T, E) => {
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C) R.y(N, "width: 150rpx");
                                          },
                                          (C, T) => {
                                            C ? T("公里") : T();
                                          }
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              R.y(
                                                N,
                                                "width: 325rpx; text-align: left;"
                                              );
                                          },
                                          (C, T) => {
                                            C ? T("配速（/公里）") : T();
                                          }
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {
                                            if (C) R.y(N, "width: 200rpx;");
                                          },
                                          (C, T) => {
                                            C ? T("累计用时") : T();
                                          }
                                        );
                                      }
                                    );
                                    F(
                                      D.speedDetailArr,
                                      "time",
                                      U ? U.speedDetailArr : undefined,
                                      ["speedDetailArr"],
                                      (C, g, h, i, j, k, T, E) => {
                                        E(
                                          "view",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              L(N, "detail-speed-main-cnt");
                                          },
                                          (C, T, E, B) => {
                                            var l =
                                              X(g).nowDistance != "" ? 1 : 0;
                                            B(l, (C, T, E) => {
                                              if (l === 1) {
                                                E(
                                                  "text",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(N, "width: 150rpx");
                                                  },
                                                  (C, T) => {
                                                    C ||
                                                    K ||
                                                    Z(i, "nowDistance")
                                                      ? T(Y(X(g).nowDistance))
                                                      : T();
                                                  }
                                                );
                                              }
                                            });
                                            var m =
                                              X(g).nowDistance != "" ? 1 : 0;
                                            B(m, (C, T, E) => {
                                              if (m === 1) {
                                                E(
                                                  "view",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      L(
                                                        N,
                                                        "speed-main-cnt-bar"
                                                      );
                                                    if (C)
                                                      R.y(N, "width: 325rpx;");
                                                  },
                                                  (C, T, E) => {
                                                    E(
                                                      "view",
                                                      {},
                                                      (N, C) => {
                                                        if (C)
                                                          R.y(
                                                            N,
                                                            "width: 150rpx; height:20rpx;background-color: rgb(100, 105, 105);"
                                                          );
                                                      },
                                                      (C, T, E) => {
                                                        E(
                                                          "view",
                                                          {},
                                                          (N, C) => {
                                                            if (C)
                                                              L(
                                                                N,
                                                                "speed-main-cnt-bar-color"
                                                              );
                                                            if (
                                                              C ||
                                                              K ||
                                                              !!Z(i, "width") ||
                                                              undefined
                                                            )
                                                              R.y(
                                                                N,
                                                                "width:" +
                                                                  Y(
                                                                    X(g).width
                                                                  ) +
                                                                  "rpx"
                                                              );
                                                          },
                                                          (C) => {}
                                                        );
                                                      }
                                                    );
                                                    E(
                                                      "text",
                                                      {},
                                                      (N, C) => {
                                                        if (C)
                                                          R.y(
                                                            N,
                                                            "margin-left:10rpx"
                                                          );
                                                      },
                                                      (C, T) => {
                                                        C ||
                                                        K ||
                                                        Z(i, "speedStr")
                                                          ? T(Y(X(g).speedStr))
                                                          : T();
                                                      }
                                                    );
                                                  }
                                                );
                                              }
                                            });
                                            var n =
                                              X(g).nowDistance != "" ? 1 : 0;
                                            B(n, (C, T, E) => {
                                              if (n === 1) {
                                                E(
                                                  "text",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(N, "width: 200rpx;");
                                                  },
                                                  (C, T) => {
                                                    C ||
                                                    K ||
                                                    Z(i, "totalTimeStr")
                                                      ? T(Y(X(g).totalTimeStr))
                                                      : T();
                                                  }
                                                );
                                              } else {
                                                E(
                                                  "text",
                                                  {},
                                                  (N, C) => {
                                                    if (C)
                                                      R.y(
                                                        N,
                                                        "width: 100%;padding-left: 150rpx; text-align: left; font-size: 25rpx;"
                                                      );
                                                  },
                                                  (C, T) => {
                                                    C ||
                                                    K ||
                                                    Z(i, "totalTimeStr")
                                                      ? T(Y(X(g).totalTimeStr))
                                                      : T();
                                                  }
                                                );
                                              }
                                            });
                                          }
                                        );
                                      }
                                    );
                                  }
                                );
                              }
                            });
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-run-bottom-ad");
                              },
                              (C, T, E) => {
                                E(
                                  "ad-custom",
                                  {},
                                  (N, C) => {
                                    if (C)
                                      O(
                                        N,
                                        "unit-id",
                                        "adunit-62342aa534f28214"
                                      );
                                  },
                                  (C) => {}
                                );
                              }
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "scroll-view-container-bottom");
                              },
                              (C) => {}
                            );
                          }
                        );
                      }
                    });
                    var f = D.runningState == 3 ? 1 : 0;
                    B(f, (C, T, E) => {
                      if (f === 1) {
                        E(
                          "view",
                          {},
                          (N, C) => {
                            if (C) L(N, "view-run-share");
                          },
                          (C, T, E, B) => {
                            var g = !D.isCheckRecord ? 1 : 0;
                            B(g, (C, T, E) => {
                              if (g === 1) {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "run-share-finish");
                                    if (C) R.r(N, "bindtap", "onFinish");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "image",
                                      {},
                                      (N, C) => {
                                        if (C)
                                          O(
                                            N,
                                            "src",
                                            "../../images/finish-run.png"
                                          );
                                      },
                                      (C) => {}
                                    );
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {},
                                      (C, T) => {
                                        C ? T("完成跑步") : T();
                                      }
                                    );
                                  }
                                );
                              }
                            });
                            var h = !D.isCheckRecord ? 1 : 0;
                            B(h, (C, T, E) => {
                              if (h === 1) {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "run-share-share");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "button",
                                      {},
                                      (N, C) => {
                                        if (C) O(N, "plain", "true");
                                        if (C) R.y(N, "border:none");
                                        if (C) O(N, "open-type", "share");
                                      },
                                      (C, T, E) => {
                                        E(
                                          "image",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              O(
                                                N,
                                                "src",
                                                "../../images/share-run.png"
                                              );
                                          },
                                          (C) => {}
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {},
                                          (C, T) => {
                                            C ? T("分享记录") : T();
                                          }
                                        );
                                      }
                                    );
                                  }
                                );
                              } else {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "run-share-share");
                                    if (C) R.y(N, "width: 90%;");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "button",
                                      {},
                                      (N, C) => {
                                        if (C) O(N, "plain", "true");
                                        if (C) R.y(N, "border:none");
                                        if (C) O(N, "open-type", "share");
                                      },
                                      (C, T, E) => {
                                        E(
                                          "image",
                                          {},
                                          (N, C) => {
                                            if (C)
                                              O(
                                                N,
                                                "src",
                                                "../../images/share-run.png"
                                              );
                                          },
                                          (C) => {}
                                        );
                                        E(
                                          "text",
                                          {},
                                          (N, C) => {},
                                          (C, T) => {
                                            C ? T("分享记录") : T();
                                          }
                                        );
                                      }
                                    );
                                  }
                                );
                              }
                            });
                          }
                        );
                      }
                    });
                  }
                );
              }
            });
            var b = D.showPopupMask ? 1 : 0;
            B(b, (C, T, E) => {
              if (b === 1) {
                E(
                  "view",
                  {},
                  (N, C) => {
                    if (C) L(N, "view-popup-bg");
                  },
                  (C) => {}
                );
              }
            });
            var c = D.showPopupMask ? 1 : 0;
            B(c, (C, T, E) => {
              if (c === 1) {
                E(
                  "view",
                  {},
                  (N, C) => {
                    if (C) L(N, "view-wrapper");
                  },
                  (C, T, E) => {
                    E(
                      "view",
                      {},
                      (N, C) => {
                        if (C) L(N, "view-popup-mask");
                      },
                      (C, T, E) => {
                        E(
                          "view",
                          {},
                          (N, C) => {
                            if (C) L(N, "view-popup-mask-top");
                          },
                          (C, T, E) => {
                            E(
                              "image",
                              {},
                              (N, C) => {
                                if (C) R.r(N, "bindtap", "onCancelAvator");
                                if (C) L(N, "image-cancel");
                                if (C)
                                  O(N, "src", "../../images/dialog_cancel.png");
                              },
                              (C) => {}
                            );
                            E(
                              "text",
                              {},
                              (N, C) => {},
                              (C, T) => {
                                C ? T("修改头像昵称") : T();
                              }
                            );
                          }
                        );
                        E(
                          "button",
                          {},
                          (N, C) => {
                            if (C) L(N, "btn-choose-avator");
                            if (C) O(N, "open-type", "chooseAvatar");
                            if (C)
                              R.v(
                                N,
                                "chooseavatar",
                                "onChooseAvatar",
                                !1,
                                !1,
                                !1,
                                !1
                              );
                          },
                          (C, T, E) => {
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-choose-avator");
                              },
                              (C, T, E) => {
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "view-choose-avator-mask");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "text",
                                      {},
                                      (N, C) => {},
                                      (C, T) => {
                                        C ? T("修改头像") : T();
                                      }
                                    );
                                  }
                                );
                                E(
                                  "view",
                                  {},
                                  (N, C) => {
                                    if (C) L(N, "view-choose-avator-image");
                                  },
                                  (C, T, E) => {
                                    E(
                                      "image",
                                      {},
                                      (N, C) => {
                                        if (C) O(N, "mode", "widthFix");
                                        if (
                                          C ||
                                          K ||
                                          !!(
                                            Z(U.avator, "length") || U.avator
                                          ) ||
                                          undefined
                                        )
                                          O(
                                            N,
                                            "src",
                                            X(D.avator).length
                                              ? D.avator
                                              : "../../images/avator.png"
                                          );
                                      },
                                      (C) => {}
                                    );
                                  }
                                );
                              }
                            );
                          }
                        );
                        E(
                          "form",
                          {},
                          (N, C) => {
                            if (C) L(N, "view-form");
                            if (C) R.r(N, "bindsubmit", "onSave");
                          },
                          (C, T, E) => {
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-popup-mask-nickname");
                              },
                              (C, T, E) => {
                                E(
                                  "input",
                                  {},
                                  (N, C) => {
                                    if (C) O(N, "type", "nickname");
                                    if (C) O(N, "maxlength", "20");
                                    if (C) O(N, "name", "nickname");
                                    if (C)
                                      O(
                                        N,
                                        "placeholder-class",
                                        "placeholder-class"
                                      );
                                    if (C || K || U.nickname)
                                      O(N, "value", D.nickname);
                                    if (C || K || U.nickname)
                                      O(N, "placeholder", D.nickname);
                                  },
                                  (C) => {}
                                );
                              }
                            );
                            E(
                              "view",
                              {},
                              (N, C) => {
                                if (C) L(N, "view-save-setting");
                              },
                              (C, T, E) => {
                                E(
                                  "button",
                                  {},
                                  (N, C) => {
                                    if (C) O(N, "form-type", "submit");
                                    if (C) O(N, "plain", "true");
                                    if (C)
                                      R.y(
                                        N,
                                        "border:none; width: 400rpx;height: 80rpx; font-size: 40rpx;"
                                      );
                                  },
                                  (C, T) => {
                                    C ? T("保存设置") : T();
                                  }
                                );
                              }
                            );
                          }
                        );
                      }
                    );
                  }
                );
              }
            });
          },
          B: A,
        };
      };
      return function (P) {
        return H[P];
      };
    })(),
  };
});
__wxRoute = "pages/run/run";
__wxRouteBegin = true;
__wxAppCurrentFile__ = "pages/run/run.js";
define(
  "pages/run/run.js",
  function (
    require,
    module,
    exports,
    window,
    document,
    frames,
    self,
    location,
    navigator,
    localStorage,
    history,
    Caches,
    screen,
    alert,
    confirm,
    prompt,
    XMLHttpRequest,
    WebSocket,
    Reporter,
    webkit,
    WeixinJSCore
  ) {
    "use strict";
    var t,
      a,
      e = require("../../@babel/runtime/helpers/regeneratorRuntime"),
      i = require("../../@babel/runtime/helpers/asyncToGenerator"),
      n = require("../../D38F48309100CF2FB5E920376AFB2D82.js"),
      o = require("../../7150F4A29100CF2F17369CA5E50C2D82.js"),
      r = 0,
      s = 0,
      d = 0,
      l = 0,
      u = [],
      c = 0,
      h = 0,
      p = 0,
      g = !1,
      S = getApp();
    Page({
      data: {
        latitude: "39.872801",
        longitude: "116.413426",
        scale: 16,
        markers: [],
        polyline: [
          {
            points: [],
            color: "#FB8337",
            colorList: [],
            width: 6,
            arrowLine: !0,
          },
        ],
        runningState: 0,
        runDistance: 0,
        runSpeed: "0′0″",
        runStartTime: 0,
        runTime: "00:00:00",
        onHideTimeStamp: 0,
        isPressStartBtn: !1,
        mapStyleKeys: [
          "RQIBZ-BJ56P-4L3DL-L2C6C-MLMHT-BNB2L",
          "6YMBZ-72KKI-PN2GY-5634L-XSBAK-OBFYA",
          "IW4BZ-TPJC6-P44SB-ED4PH-HE4SO-SZBOF",
        ],
        mapStyleKey: 0,
        mapStyleIndex: 1,
        mapStyleChoose: 1,
        countdwnSecond: "",
        mapViewHeight: "100%",
        speedDetailArr: [],
        isCheckRecord: !1,
        showPopupMask: !1,
        isSatelliteStyle: !1,
      },
      initParms: function () {
        (r = 0),
          (s = 0),
          (d = 0),
          (l = 0),
          (u = []),
          (c = 0),
          (h = 0),
          (p = 0),
          (g = !1),
          (this.data.isSatelliteStyle = S.globalData.enableSatelliteStyle);
      },
      onLoad: function (t) {
        if (
          (this.initParms(),
          (c = wx.getSystemInfoSync().SDKVersion),
          (this.data.mapContext = wx.createMapContext("map")),
          "{}" == JSON.stringify(t))
        ) {
          (r = 0),
            (s = 0),
            (d = 0),
            (l = 0),
            (u = []),
            wx.setNavigationBarColor({
              frontColor: "#ffffff",
              backgroundColor: "#F33756",
            }),
            wx.canIUse("hideHomeButton") && wx.hideHomeButton();
          var a = this;
          setTimeout(function () {
            a.countdown();
          }, 500),
            o.info("onLoad countdown");
        } else
          "index" == t.getInPage
            ? (this.getInFromIndex(t), o.info("onLoad getInFromIndex"))
            : (this.getInFromRecord(t), o.info("onLoad getInFromRecord"));
      },
      getInFromIndex: function (t) {
        wx.setNavigationBarColor({
          frontColor: "#ffffff",
          backgroundColor: "#F33756",
        }),
          wx.canIUse("hideHomeButton") && wx.hideHomeButton();
        var a = JSON.parse(t.records);
        (u = a.runPoints ? a.runPoints : []),
          (s = this.timeStrToSecond(a.runTime)),
          (d = a.runDistance),
          (this.data.polyline[0].points = u.map(function (t) {
            return { latitude: t.latitude, longitude: t.longitude };
          }));
        var e = u.length;
        if (e > 0) {
          var i = {
            id: 0,
            iconPath: "../../images/road-start.png",
            latitude: u[0].latitude,
            longitude: u[0].longitude,
            width: 60,
            height: 60,
          };
          (this.data.markers = [i]),
            (this.data.speedDetailArr = a.speedDetailArr
              ? a.speedDetailArr
              : []),
            this.data.speedDetailArr.length && this.data.speedDetailArr.pop();
        }
        (l = 0),
          (this.data.runStartTime = a.runStartTime),
          (this.data.runStartTimeStr = n.format(new Date(a.runStartTime))),
          this.setData({
            runDistance: a.runDistance,
            runTime: a.runTime,
            runStartTimeStr: this.data.runStartTimeStr,
            latitude: e ? u[e - 1].latitude : this.data.latitude,
            longitude: e ? u[e - 1].longitude : this.data.longitude,
            runningState: 1,
            polyline: this.data.polyline,
            markers: this.data.markers,
            isPressStartBtn: !0,
            isSatelliteStyle: this.data.isSatelliteStyle,
          }),
          this.startGetGPS();
      },
      getInFromRecord: function (t) {
        var a = JSON.parse(t.records);
        (u = a.runPoints ? a.runPoints : []),
          (s = this.timeStrToSecond(a.runTime)),
          (d = a.runDistance),
          this.calRunSpeedColor();
        var e = u.length;
        if (e > 1) {
          var i = {
              id: 0,
              iconPath: "../../images/road-start.png",
              latitude: u[0].latitude,
              longitude: u[0].longitude,
              width: 60,
              height: 60,
            },
            n = {
              id: 1,
              iconPath: "../../images/road-stop.png",
              latitude: u[e - 1].latitude,
              longitude: u[e - 1].longitude,
              width: 60,
              height: 60,
            };
          (this.data.markers = [i, n]),
            (this.data.speedDetailArr = a.speedDetailArr
              ? a.speedDetailArr
              : []),
            this.addRunDistanceMarker(this.data.speedDetailArr);
        }
        this.setData({
          nickname: S.globalData.nickname,
          avator: S.globalData.avator,
          isCheckRecord: !0,
          runDistance: a.runDistance,
          runStartTimeStr: a.runStartTime,
          runTime: a.runTime,
          avgSpeed: a.runSpeed,
          runColarie: a.runColarie ? a.runColarie : "-",
          latitude: u.length ? u[0].latitude : this.data.latitude,
          longitude: u.length ? u[0].longitude : this.data.longitude,
          speedDetailArr: this.data.speedDetailArr,
          maxSpeed: a.maxSpeed ? a.maxSpeed : "-",
          minSpeed: a.minSpeed ? a.minSpeed : "-",
          runningState: 3,
          polyline: this.data.polyline,
          markers: this.data.markers,
          mapViewHeight: "650rpx",
        }),
          this.adjustMapScale(),
          console.log(this.data.speedDetailArr),
          console.log(this.data.polyline),
          this.onRewindTrackRoute();
      },
      checkAuthorize: function () {
        var t = this;
        wx.getSetting({
          success: function (a) {
            a.authSetting["scope.userLocationBackground"]
              ? t.getCurrentLocation()
              : wx.showModal({
                  title: "提示",
                  content:
                    '为确保后台定位精确，请先设置位置为"使用小程序期间和离开后" 再进行跑步',
                  showCancel: !1,
                  success: function (t) {
                    t.confirm && wx.openSetting();
                  },
                });
          },
          fail: function (t) {
            console.log(t);
          },
        });
      },
      getCurrentLocation: function () {
        var t = this;
        wx.authorize({
          scope: "scope.userLocation",
          success: function (a) {
            console.log(a),
              wx.getLocation({
                type: "gcj02",
                isHighAccuracy: !0,
                success: function (a) {
                  console.log(a),
                    t.setData({ latitude: a.latitude, longitude: a.longitude });
                },
                fail: function (t) {
                  console.log(t);
                },
              });
          },
          fail: function (t) {
            console.log(t);
          },
        });
      },
      convertTimeStr: function (t) {
        var a = parseInt(t / 3600),
          e = parseInt((t % 3600) / 60),
          i = t % 60;
        return (
          (a = a < 10 ? "0" + a : a) +
          ":" +
          (e = e < 10 ? "0" + e : e) +
          ":" +
          (i = i < 10 ? "0" + i : i)
        );
      },
      timeStrToSecond: function (t) {
        var a = t.split(":")[0],
          e = t.split(":")[1],
          i = t.split(":")[2];
        return Number(3600 * a) + Number(60 * e) + Number(i);
      },
      runTimer: function () {
        s++, this.setData({ runTime: this.convertTimeStr(s) });
      },
      toRadians: function (t) {
        return (t * Math.PI) / 180;
      },
      calPointDistance: function (t, a, e, i) {
        var n = this.toRadians(t),
          o = this.toRadians(e),
          r = n - o,
          s = this.toRadians(a) - this.toRadians(i);
        return (
          (6378137 *
            (2 *
              Math.asin(
                Math.sqrt(
                  Math.pow(Math.sin(r / 2), 2) +
                    Math.cos(n) * Math.cos(o) * Math.pow(Math.sin(s / 2), 2)
                )
              ))) /
          1e3
        );
      },
      getDistance: function (t, a, e, i) {
        var n = Math.floor(d);
        d += this.calPointDistance(t, a, e, i);
        var o = Math.floor(d);
        if (o > n) {
          var r = this.data.speedDetailArr.length,
            s = Date.parse(new Date()),
            l = parseInt((s - this.data.runStartTime) / 1e3) - p,
            u = r > 0 ? l - this.data.speedDetailArr[r - 1].totalTime : l;
          this.data.speedDetailArr.push({
            nowDistance: o,
            latitude: e,
            longitude: i,
            totalTime: l,
            totalTimeStr: this.convertTimeStr(l),
            speedStr: parseInt(u / 60) + "′" + parseInt(u % 60) + "″",
            speed: u,
            width: "",
          }),
            console.log(this.data.speedDetailArr);
        }
        return Number(d.toFixed(2));
      },
      runStateInit: function () {
        if (
          (o.info("runStateInit", this.data.runningState),
          1 == this.data.runningState)
        ) {
          var t = new Date();
          (this.data.runStartTime = Date.parse(t)),
            (this.data.runStartTimeStr = n.format(t)),
            this.setData({
              runningState: 1,
              runDistance: 0,
              runTime: "00:00:00",
              runSpeed: "0′0″",
              runStartTimeStr: this.data.runStartTimeStr,
              "polyline[0].points": [],
            }),
            (u = []);
        } else if (2 == this.data.runningState) {
          (p += (Date.parse(new Date()) - h) / 1e3),
            this.startAnimation(0, 0, 0),
            wx.removeStorage({
              key: S.globalData.openId,
              success: function (t) {
                console.log(t), o.info("removeStorage", t);
              },
            });
          var a = this;
          setTimeout(function () {
            a.setData({ runningState: 1 });
          }, 500);
        }
        (this.data.isPressStartBtn = !0), (l = 0);
      },
      setStartMarker: function (t, a) {
        this.data.markers = [
          {
            id: 0,
            iconPath: "../../images/road-start.png",
            latitude: t,
            longitude: a,
            width: 60,
            height: 60,
          },
        ];
      },
      dealLocationChange: function (t) {
        l++;
        var a = u.length;
        if (5 >= l)
          0 == a
            ? (this.setStartMarker(t.latitude, t.longitude),
              this.setData({
                latitude: t.latitude,
                longitude: t.longitude,
                markers: this.data.markers,
              }))
            : this.setData({ latitude: t.latitude, longitude: t.longitude });
        else if (
          (this.data.latitude != t.latitude ||
            this.data.longitude != t.longitude) &&
          this.data.isPressStartBtn
        ) {
          var e = this.data.runDistance;
          0 == a
            ? (this.setStartMarker(t.latitude, t.longitude),
              this.setData({ markers: this.data.markers }))
            : (e = this.getDistance(
                this.data.latitude,
                this.data.longitude,
                t.latitude,
                t.longitude
              ));
          var i = Date.parse(new Date());
          (a > 10 && (i - u[a - 1].currenttime) / 1e3 < 3) ||
            (u.push({
              latitude: t.latitude,
              longitude: t.longitude,
              speed: t.speed,
              currenttime: i,
            }),
            this.data.polyline[0].points.push({
              latitude: t.latitude,
              longitude: t.longitude,
            }));
          var n = "0′0″";
          t.speed > 0 &&
            (n =
              parseInt(1e3 / t.speed / 60) +
              "′" +
              parseInt((1e3 / t.speed) % 60) +
              "″"),
            this.setData({
              "polyline[0].points": this.data.polyline[0].points,
              latitude: t.latitude,
              longitude: t.longitude,
              runSpeed: n,
              runDistance: e,
            });
        }
      },
      startGetGPS: function () {
        var t = this;
        o.info("startGetGPS", g),
          wx.startLocationUpdateBackground({
            success: function () {
              g ||
                wx.onLocationChange(function (a) {
                  t.dealLocationChange(a);
                }),
                (g = !0);
            },
            fail: function (t) {
              console.log(t), o.info("startGetGPS", t);
            },
          });
      },
      startRun: function () {
        o.info("startRun", p),
          this.runStateInit(),
          wx.showToast({
            title: "开始跑步",
            icon: "none",
            duration: 1e3,
            mask: !1,
          }),
          p > 0 && this.startGetGPS();
        var t = this;
        r = setInterval(function () {
          t.runTimer();
        }, 1e3);
      },
      pauseRun: function () {
        o.info("pauseRun"),
          clearInterval(r),
          (g = !1),
          wx.showToast({
            title: "暂停跑步",
            icon: "none",
            duration: 1e3,
            mask: !1,
          }),
          (h = Date.parse(new Date())),
          this.setData({ runningState: 2, runTime: this.convertTimeStr(s) }),
          wx.offLocationChange(),
          wx.stopLocationUpdate(),
          (this.data.isPressStartBtn = !1),
          this.startAnimation(-120, 120, 1),
          this.SaveDataToDisk(0);
      },
      stopRun: function () {
        o.info("stopRun"),
          clearInterval(r),
          this.startAnimation(0, 0, 0),
          wx.showLoading({ title: "跑步数据汇总中", mask: !0 }),
          this.data.markers.push({
            id: 1,
            iconPath: "../../images/road-stop.png",
            longitude: this.data.longitude,
            latitude: this.data.latitude,
            width: 60,
            height: 60,
          });
        var t = parseFloat(d) + parseFloat(S.globalData.todayRunDistance);
        S.globalData.todayRunDistance = Number(t.toFixed(2));
        var a = Number(parseFloat(d).toFixed(2)),
          e = "0′0″";
        0 != a &&
          (e = parseInt(s / a / 60) + "′" + parseInt((s / a) % 60) + "″"),
          this.calRunSpeedColor();
        var i = this.countDetailSpeed(),
          n = i[0],
          l = i[1],
          c = this.data.speedDetailArr.length
            ? s -
              this.data.speedDetailArr[this.data.speedDetailArr.length - 1]
                .totalTime
            : s;
        c > 0 &&
          this.data.speedDetailArr.push({
            nowDistance: "",
            latitude: this.data.latitude,
            longitude: this.data.longitude,
            totalTime: s,
            totalTimeStr: "最后不足1公里用时：" + this.convertTimeStr(c),
            speedStr: "",
            speed: "",
            width: "",
          }),
          this.addRunDistanceMarker(this.data.speedDetailArr),
          this.setData({
            runningState: 3,
            markers: this.data.markers,
            avgSpeed: e,
            nickname: S.globalData.nickname,
            avator: S.globalData.avator,
            runColarie: d ? parseInt(62.5 * d) : 0,
            polyline: this.data.polyline,
            speedDetailArr: this.data.speedDetailArr,
            maxSpeed: parseInt(n / 60) + "′" + parseInt(n % 60) + "″",
            minSpeed: parseInt(l / 60) + "′" + parseInt(l % 60) + "″",
            mapViewHeight: "650rpx",
          }),
          wx.offLocationChange(),
          wx.stopLocationUpdate(),
          this.adjustMapScale();
        var h = u.length;
        if (h > 1e3) {
          for (var p = Math.ceil(h / 1e3), g = [], m = 0; m < h; m += p)
            g.push(u[m]);
          (u = g), console.log(u);
        }
        var f = {
          runDistance: a,
          runSpeed: e,
          runTime: this.data.runTime,
          runStartTime: this.data.runStartTime,
          runPoints: u,
          runColarie: this.data.runColarie,
          speedDetailArr: this.data.speedDetailArr,
          maxSpeed: this.data.maxSpeed,
          minSpeed: this.data.minSpeed,
        };
        (s = 0),
          (d = 0),
          (this.data.isPressStartBtn = !1),
          this.updateUserRecord(f),
          o.info("stopRun", f),
          setTimeout(function () {
            wx.hideLoading();
          }, 1e3),
          this.shareWeRun();
      },
      shareWeRun: function () {
        var t = parseInt(1e3 * this.data.runDistance);
        1 != this.compareVersion("2.14.0", c) &&
          t > 0 &&
          t < 1e5 &&
          wx.shareToWeRun({
            recordList: [{ typeId: 3001, distance: t }],
            success: function (t) {
              wx.showToast({ title: "打卡成功" });
            },
            fail: function (t) {
              wx.showToast({ icon: "none", title: "打卡失败" });
            },
          });
      },
      SaveDataToDisk: function (t) {
        o.info("SaveDataToDisk exitType " + t);
        var a = Number(parseFloat(d).toFixed(2)),
          e = "0′0″";
        0 != a &&
          (e = parseInt(s / a / 60) + "′" + parseInt((s / a) % 60) + "″");
        var i = this.countDetailSpeed(),
          n = i[0],
          r = i[1],
          l = this.data.speedDetailArr.length
            ? s -
              this.data.speedDetailArr[this.data.speedDetailArr.length - 1]
                .totalTime
            : s,
          c = JSON.parse(JSON.stringify(this.data.speedDetailArr));
        l > 0 &&
          c.push({
            nowDistance: "",
            latitude: this.data.latitude,
            longitude: this.data.longitude,
            totalTime: s,
            totalTimeStr: "最后不足1公里用时：" + this.convertTimeStr(l),
            speedStr: "",
            speed: "",
            width: "",
          });
        var h = {
          runDistance: a,
          runSpeed: e,
          runTime: this.data.runTime,
          runStartTime: this.data.runStartTime,
          runPoints: u,
          runColarie: d ? parseInt(62.5 * d) : 0,
          speedDetailArr: c,
          maxSpeed: parseInt(n / 60) + "′" + parseInt(n % 60) + "″",
          minSpeed: parseInt(r / 60) + "′" + parseInt(r % 60) + "″",
        };
        o.info("SaveDataToDisk", h),
          wx.setStorage({
            key: S.globalData.openId,
            data: { record: h, exitType: t },
            success: function (t) {
              console.log(t), o.info(t);
            },
            fail: function (t) {
              console.log(t), o.info(t);
            },
          });
      },
      getSpeedColor: function (t, a) {
        if ((a = 0 == a ? 0 : parseInt(1e3 / a)) < t)
          var e = t - a > 255 ? 0 : 255 - t + a,
            i =
              "#" +
              (n = (n = (e -= e % 10).toString(16)).length < 2 ? "0" + n : n) +
              "FF00";
        else {
          var n;
          e = 255 - (e = a - t > 255 ? 255 : a - t);
          i =
            "#FF" +
            (n = (n = (e -= e % 10).toString(16)).length < 2 ? "0" + n : n) +
            "00";
        }
        return i;
      },
      calRunSpeedColor: function () {
        var t = u.length;
        if (0 != t) {
          var a = 0 == d ? 0 : parseInt(s / d),
            e = {
              points: [],
              color: "#FB8337",
              colorList: [],
              width: 6,
              arrowLine: !0,
            };
          this.data.polyline = [];
          for (var i = 0; i < t; i++) {
            e.points.push({
              latitude: u[i].latitude,
              longitude: u[i].longitude,
            });
            var n = this.getSpeedColor(a, u[i].speed);
            e.colorList.push(n),
              ((0 == i % 49 && 0 != i) || i == t - 1) &&
                (this.data.polyline.push(JSON.parse(JSON.stringify(e))),
                (e.points = [
                  { latitude: u[i].latitude, longitude: u[i].longitude },
                ]),
                (e.colorList = []));
          }
        }
      },
      countDetailSpeed: function () {
        var t = 0,
          a = 0,
          e = 0;
        this.data.speedDetailArr.length > 0 &&
          ((t = this.data.speedDetailArr[0].speed),
          (a = this.data.speedDetailArr[0].speed));
        for (var i = 0; i < this.data.speedDetailArr.length; i++)
          this.data.speedDetailArr[i].speed > a
            ? ((a = this.data.speedDetailArr[i].speed), (e = i))
            : this.data.speedDetailArr[i].speed < t &&
              (t = this.data.speedDetailArr[i].speed);
        for (i = 0; i < this.data.speedDetailArr.length; i++) {
          var n =
            (this.data.speedDetailArr[e].speed -
              this.data.speedDetailArr[i].speed) /
            this.data.speedDetailArr[e].speed;
          this.data.speedDetailArr[i].width = parseInt(150 * (1 - n));
        }
        return console.log(this.data.speedDetailArr), [t, a];
      },
      addRunDistanceMarker: function (t) {
        var a = {
          iconPath: "../../images/road-stop.png",
          id: 2,
          latitude: 30.484483235677,
          longitude: 114.44521972656,
          width: 1,
          height: 1,
          label: {
            content: "1",
            fontSize: 10,
            color: "#FFFFFF",
            borderRadius: 10,
            borderWidth: 2,
            borderColor: "#FFFFFF",
            bgColor: "#252630",
            padding: 5,
            textAlign: "center",
            anchorX: -10,
            anchorY: -10,
          },
        };
        if (t.length > 2)
          for (var e = 0; e < t.length - 1; e++)
            (a.id = e + 2),
              (a.latitude = t[e].latitude),
              (a.longitude = t[e].longitude),
              (a.label.content = t[e].nowDistance.toString()),
              this.data.markers.push(JSON.parse(JSON.stringify(a)));
      },
      startAnimation: function (t, a, e) {
        var i = wx.createAnimation({ duration: 500 }),
          n = wx.createAnimation({ duration: 500 }),
          o = wx.getSystemInfoSync().windowWidth / 750;
        i
          .translate(t * o, 0)
          .opacity(e)
          .step(),
          n
            .translate(a * o, 0)
            .opacity(e)
            .step(),
          this.setData({
            animation_stop: i.export(),
            animation_continue: n.export(),
          });
      },
      adjustMapScale: function () {
        this.data.mapContext.includePoints({
          points: u,
          padding: [50, 30, 50, 30],
        });
      },
      checkGPS: function () {
        return wx.getSystemInfoSync().locationEnabled;
      },
      updateUserRecord: function (t) {
        var a = this,
          e = {
            purpose: "updateRunRecord",
            key: { openId: S.globalData.openId, record: t },
          };
        n.request("", "POST", e)
          .then(function (a) {
            console.log(a),
              o.info("updateUserRecord", a),
              (S.globalData.lastRunstartTime = t.runStartTime),
              wx.removeStorage({
                key: S.globalData.openId,
                success: function (t) {
                  console.log(t), o.info("removeStorage", t);
                },
              });
          })
          .catch(function (e) {
            console.log(e),
              o.info(e),
              wx.showModal({
                title: "提示",
                content: "网络异常!上传跑步记录失败,点击确定再次尝试？",
                success: function (e) {
                  e.confirm
                    ? (console.log("用户点击确定"), a.updateUserRecord(t))
                    : e.cancel && console.log("用户点击取消");
                },
              });
          });
      },
      onRecord: function () {
        wx.navigateTo({ url: "../../pages/record/record" });
      },
      onRank: function () {
        wx.navigateTo({ url: "../../pages/rank/rank" });
      },
      onLocate: function () {
        1 != this.data.runningState && this.getCurrentLocation();
      },
      onChangeMapStyle: function () {
        (this.data.isSatelliteStyle = !this.data.isSatelliteStyle),
          this.setData({ isSatelliteStyle: this.data.isSatelliteStyle }),
          (S.globalData.enableSatelliteStyle = this.data.isSatelliteStyle);
      },
      onRewindTrackRoute: function () {},
      onReady: function () {},
      onShow: function () {
        console.log("onShow"),
          o.info(
            "onShow",
            this.data.isPressStartBtn,
            this.data.onHideTimeStamp
          );
        var t = this;
        if (this.data.isPressStartBtn) {
          var a = Date.parse(new Date());
          0 == this.data.onHideTimeStamp
            ? (clearInterval(r),
              (s = parseInt(a - this.data.runStartTime) / 1e3))
            : (s += parseInt(a - this.data.onHideTimeStamp) / 1e3),
            (this.data.onHideTimeStamp = 0),
            (r = setInterval(function () {
              t.runTimer();
            }, 1e3));
        }
      },
      countdown: function () {
        this.setData({
          latitude: S.globalData.latitude,
          longitude: S.globalData.longitude,
          isSatelliteStyle: this.data.isSatelliteStyle,
        }),
          this.startGetGPS();
        var t = wx.createAnimation({ duration: 1e3, timingFunction: "ease" }),
          a = (wx.getSystemInfoSync().windowWidth, this);
        a.data.countdwnSecond = 4;
        var e = setInterval(function () {
          1 < a.data.countdwnSecond
            ? (t
                .scale(2, 2)
                .opacity(1)
                .step({ duration: 700 })
                .scale(1, 1)
                .opacity(0.01)
                .step({ duration: 300 }),
              a.setData({
                countdwnSecond: --a.data.countdwnSecond,
                animation_countdown: t.export(),
              }))
            : (clearInterval(e),
              wx.setNavigationBarColor({
                frontColor: "#ffffff",
                backgroundColor: "#252630",
              }),
              (a.data.runningState = 1),
              a.startRun());
        }, 1100);
      },
      onFinish: function () {
        wx.reLaunch({ url: "../../pages/index/index" });
      },
      onShareRecord: function () {},
      compareVersion: function (t, a) {
        (t = t.split(".")), (a = a.split("."));
        for (var e = Math.max(t.length, a.length); t.length < e; ) t.push("0");
        for (; a.length < e; ) a.push("0");
        for (var i = 0; i < e; i++) {
          var n = parseInt(t[i]),
            o = parseInt(a[i]);
          if (n > o) return 1;
          if (n < o) return -1;
        }
        return 0;
      },
      onSettingUseInfo: function () {
        if (S.globalData.hasPrivacyAuthrize) {
          var t = this;
          1 == this.compareVersion("2.10.4", c)
            ? wx.showToast({
                title: "您的微信版本太低，无法设置头像昵称",
                icon: "none",
                duration: 1e3,
                mask: !1,
              })
            : 1 == this.compareVersion("2.21.2", c)
            ? wx.getUserProfile({
                desc: "申请获取您的微信头像昵称",
                success: function (a) {
                  var e = a.userInfo;
                  console.log(e),
                    t.setData({ nickname: e.nickName, avator: e.avatarUrl }),
                    wx.downloadFile({
                      url: t.data.avator,
                      success: function (a) {
                        console.log(a),
                          200 == a.statusCode &&
                            ((t.data.avator = a.tempFilePath),
                            t.uploadAvatorInfo(),
                            (S.globalData.nickname = t.data.nickname),
                            (S.globalData.avator = t.data.avator));
                      },
                      fail: function (t) {
                        console.log(t);
                      },
                    });
                },
                fail: function (t) {
                  console.log("用户拒绝授权");
                },
              })
            : this.setData({ showPopupMask: !0 });
        } else
          wx.showToast({
            title: "没有取得您的授权，不支持设置~",
            icon: "none",
            duration: 1e3,
            mask: !1,
          });
      },
      onChooseAvatar: function (t) {
        (this.data.avator = t.detail.avatarUrl),
          this.setData({ avator: this.data.avator });
      },
      onSave:
        ((a = i(
          e().mark(function t(a) {
            var i, r;
            return e().wrap(
              function (t) {
                for (;;)
                  switch ((t.prev = t.next)) {
                    case 0:
                      if (
                        ((i = 0),
                        (this.data.nickname = a.detail.value.nickname),
                        !(
                          this.data.avator.length > 0 &&
                          S.globalData.avator != this.data.avator
                        ))
                      ) {
                        t.next = 8;
                        break;
                      }
                      return (t.next = 5), this.uploadAvatorInfo();
                    case 5:
                      (i = t.sent), (t.next = 9);
                      break;
                    case 8:
                      this.data.nickname.length > 0 &&
                        S.globalData.nickname != this.data.nickname &&
                        ((r = {
                          purpose: "updateAvatorInfo",
                          key: {
                            openId: S.globalData.openId,
                            userinfo: {
                              nickname: this.data.nickname,
                              avator: this.data.avator,
                            },
                          },
                        }),
                        n
                          .request("", "POST", r)
                          .then(function (t) {
                            console.log(t), o.info("onSave", t);
                          })
                          .catch(function (t) {
                            console.log(t), o.info("onSave", t);
                          }));
                    case 9:
                      0 == i
                        ? ((S.globalData.nickname = this.data.nickname),
                          (S.globalData.avator = this.data.avator),
                          this.setData({
                            showPopupMask: !1,
                            nickname: S.globalData.nickname,
                            avator: S.globalData.avator,
                          }),
                          wx.showToast({
                            title: "修改成功",
                            icon: "none",
                            duration: 1e3,
                            mask: !1,
                          }))
                        : (this.setData({ showPopupMask: !1 }),
                          wx.showToast({
                            title: "修改失败，请稍后重试",
                            icon: "none",
                            duration: 1e3,
                            mask: !1,
                          }));
                    case 10:
                    case "end":
                      return t.stop();
                  }
              },
              t,
              this
            );
          })
        )),
        function (t) {
          return a.apply(this, arguments);
        }),
      onCancelAvator: function (t) {
        this.setData({ showPopupMask: !1 }),
          (this.data.avator = S.globalData.avator),
          (this.data.nickname = S.globalData.nickname);
      },
      uploadAvatorInfo:
        ((t = i(
          e().mark(function t() {
            var a, i;
            return e().wrap(
              function (t) {
                for (;;)
                  switch ((t.prev = t.next)) {
                    case 0:
                      return (
                        (a = {
                          nickname: this.data.nickname,
                          openid: S.globalData.openId,
                        }),
                        (i = 0),
                        (t.next = 4),
                        n
                          .upload("", this.data.avator, a)
                          .then(function (t) {
                            0 != t.errcode && (i = -1);
                          })
                          .catch(function (t) {
                            console.log(t), (i = -1);
                          })
                      );
                    case 4:
                      return t.abrupt("return", i);
                    case 5:
                    case "end":
                      return t.stop();
                  }
              },
              t,
              this
            );
          })
        )),
        function () {
          return t.apply(this, arguments);
        }),
      onHide: function () {
        console.log("onHide"),
          o.info("onHide", this.data.isPressStartBtn),
          this.data.isPressStartBtn &&
            (clearInterval(r),
            (this.data.onHideTimeStamp = Date.parse(new Date())));
      },
      onUnload: function () {
        if (
          (console.log("onUnload"),
          o.info("onUnload", this.data.isPressStartBtn),
          this.data.isPressStartBtn)
        ) {
          clearInterval(r), wx.offLocationChange(), wx.stopLocationUpdate();
          var t = Date.parse(new Date());
          (s = parseInt(t - this.data.runStartTime) / 1e3),
            (this.data.runTime = this.convertTimeStr(s)),
            this.SaveDataToDisk(1),
            (g = !1),
            (this.data.isPressStartBtn = !1);
        }
      },
      onSaveExitState: function () {
        if (
          (console.log("onSaveExitState"),
          o.info("onSaveExitState", this.data.isPressStartBtn),
          this.data.isPressStartBtn)
        ) {
          var t = Date.parse(new Date());
          (s = parseInt(t - this.data.runStartTime) / 1e3),
            (this.data.runTime = this.convertTimeStr(s)),
            this.SaveDataToDisk(2);
        }
      },
      onPullDownRefresh: function () {},
      onReachBottom: function () {},
      onShareAppMessage: function () {
        return {
          title: "一起来跑步打卡吧~",
          path: "pages/index/index",
          imageUrl: "",
        };
      },
    });
  },
  { isPage: true, isComponent: true, currentFile: "pages/run/run.js" }
);
require("pages/run/run.js");
